package bb.lanxing.lib.devices.ble.ble.services;

//import com.alipay.sdk.packet.d;
import bb.lanxing.lib.devices.ble.BLEAttributes;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleSensorDevice;
import bb.lanxing.lib.devices.ble.ble.base.BaseBleService;
import bb.lanxing.lib.devices.ble.ble.characteristic.SensorLocationCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cyclingpower.CyclingPowerControlPointCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cyclingpower.CyclingPowerFeatureCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cyclingpower.CyclingPowerMeasurementCharacteristics;
import bb.lanxing.lib.devices.ble.ble.characteristic.cyclingpower.CyclingPowerVectorCharacteristics;
import java.util.UUID;
import kotlin.Metadata;
import kotlin.ResultKt;
import kotlin.Unit;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.IntrinsicsKt;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: CyclingPowerService.kt */

public final class CyclingPowerService extends BaseBleService {
    private CyclingPowerControlPointCharacteristics cyclingPowerControlPointCharacteristics;
    private CyclingPowerFeatureCharacteristics cyclingPowerFeatureCharacteristics;
    private CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics;
    private CyclingPowerVectorCharacteristics cyclingPowerVectorCharacteristics;
    private SensorLocationCharacteristics sensorLocationCharacteristics;

    public CyclingPowerService(BaseBleSensorDevice device) {
        super(device);
//        Intrinsics.checkNotNullParameter(device, "device");
    }

    public CyclingPowerControlPointCharacteristics getCyclingPowerControlPointCharacteristics() {
        return this.cyclingPowerControlPointCharacteristics;
    }

    public void setCyclingPowerControlPointCharacteristics(CyclingPowerControlPointCharacteristics cyclingPowerControlPointCharacteristics) {
        this.cyclingPowerControlPointCharacteristics = cyclingPowerControlPointCharacteristics;
    }

    public CyclingPowerFeatureCharacteristics getCyclingPowerFeatureCharacteristics() {
        return this.cyclingPowerFeatureCharacteristics;
    }

    public void setCyclingPowerFeatureCharacteristics(CyclingPowerFeatureCharacteristics cyclingPowerFeatureCharacteristics) {
        this.cyclingPowerFeatureCharacteristics = cyclingPowerFeatureCharacteristics;
    }

    public CyclingPowerVectorCharacteristics getCyclingPowerVectorCharacteristics() {
        return this.cyclingPowerVectorCharacteristics;
    }

    public void setCyclingPowerVectorCharacteristics(CyclingPowerVectorCharacteristics cyclingPowerVectorCharacteristics) {
        this.cyclingPowerVectorCharacteristics = cyclingPowerVectorCharacteristics;
    }

    public CyclingPowerMeasurementCharacteristics getCyclingPowerMeasurementCharacteristics() {
        return this.cyclingPowerMeasurementCharacteristics;
    }

    public void setCyclingPowerMeasurementCharacteristics(CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics) {
        this.cyclingPowerMeasurementCharacteristics = cyclingPowerMeasurementCharacteristics;
    }

    public SensorLocationCharacteristics getSensorLocationCharacteristics() {
        return this.sensorLocationCharacteristics;
    }

    public void setSensorLocationCharacteristics(SensorLocationCharacteristics sensorLocationCharacteristics) {
        this.sensorLocationCharacteristics = sensorLocationCharacteristics;
    }

    @Override
    public UUID targetUUID() {
        UUID fromString = UUID.fromString(BLEAttributes.BLE_CYCLING_POWER_SERVICE);
        Intrinsics.checkNotNullExpressionValue(fromString, "fromString(BLEAttributes…LE_CYCLING_POWER_SERVICE)");
        return fromString;
    }

    public final class CyclingPowerService$initialization$1 extends ContinuationImpl {
        Object L$0;
        int label;
        Object result;
        final CyclingPowerService this$0;

        public CyclingPowerService$initialization$1(CyclingPowerService cyclingPowerService, Continuation<? super CyclingPowerService$initialization$1> continuation) {
            super((Continuation<Object>) continuation);
            this.this$0 = cyclingPowerService;
        }

        @Override
        public Object invokeSuspend(Object obj) {
            this.result = obj;
            this.label |= Integer.MIN_VALUE;
            return this.this$0.initialization(this);
        }
    }

    @Override
    public Object initialization(Continuation<? super Unit> continuation) {
        CyclingPowerService$initialization$1 cyclingPowerService$initialization$1;
        Object coroutine_suspended;
        int i;
        CyclingPowerService cyclingPowerService = null;
        CyclingPowerService cyclingPowerService2;
        if (continuation instanceof CyclingPowerService$initialization$1) {
            cyclingPowerService$initialization$1 = (CyclingPowerService$initialization$1) continuation;
            if ((cyclingPowerService$initialization$1.label & Integer.MIN_VALUE) != 0) {
                cyclingPowerService$initialization$1.label -= Integer.MIN_VALUE;
                Object obj = cyclingPowerService$initialization$1.result;
                coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
                i = cyclingPowerService$initialization$1.label;
                if (i != 0) {
                    ResultKt.throwOnFailure(obj);
                    CyclingPowerControlPointCharacteristics cyclingPowerControlPointCharacteristics = new CyclingPowerControlPointCharacteristics(this);
                    cyclingPowerControlPointCharacteristics.enableNotify();
                    this.cyclingPowerControlPointCharacteristics = cyclingPowerControlPointCharacteristics;
                    cyclingPowerService$initialization$1.L$0 = this;
                    cyclingPowerService$initialization$1.label = 1;
                    if (delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
                        return coroutine_suspended;
                    }
                    cyclingPowerService = this;
                } else if (i == 1) {
                    cyclingPowerService = (CyclingPowerService) cyclingPowerService$initialization$1.L$0;
                    ResultKt.throwOnFailure(obj);
                } else if (i != 2) {
                    if (i != 3) {
                        if (i == 4) {
                            cyclingPowerService2 = (CyclingPowerService) cyclingPowerService$initialization$1.L$0;
                            ResultKt.throwOnFailure(obj);
                            SensorLocationCharacteristics sensorLocationCharacteristics = new SensorLocationCharacteristics(cyclingPowerService2);
                            sensorLocationCharacteristics.read();
                            cyclingPowerService2.sensorLocationCharacteristics = sensorLocationCharacteristics;
                            return Unit.INSTANCE;
                        }
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    cyclingPowerService = (CyclingPowerService) cyclingPowerService$initialization$1.L$0;
                    ResultKt.throwOnFailure(obj);
                    CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics = new CyclingPowerMeasurementCharacteristics(cyclingPowerService);
                    cyclingPowerMeasurementCharacteristics.enableNotify();
                    cyclingPowerService.cyclingPowerMeasurementCharacteristics = cyclingPowerMeasurementCharacteristics;
                    cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                    cyclingPowerService$initialization$1.label = 4;
                    if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) != coroutine_suspended) {
                        return coroutine_suspended;
                    }
                    cyclingPowerService2 = cyclingPowerService;
                    SensorLocationCharacteristics sensorLocationCharacteristics2 = new SensorLocationCharacteristics(cyclingPowerService2);
                    sensorLocationCharacteristics2.read();
                    cyclingPowerService2.sensorLocationCharacteristics = sensorLocationCharacteristics2;
                    return Unit.INSTANCE;
                } else {
                    cyclingPowerService = (CyclingPowerService) cyclingPowerService$initialization$1.L$0;
                    ResultKt.throwOnFailure(obj);
                    CyclingPowerVectorCharacteristics cyclingPowerVectorCharacteristics = new CyclingPowerVectorCharacteristics(cyclingPowerService);
                    cyclingPowerVectorCharacteristics.enableNotify();
                    cyclingPowerService.cyclingPowerVectorCharacteristics = cyclingPowerVectorCharacteristics;
                    cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                    cyclingPowerService$initialization$1.label = 3;
                    if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
                        return coroutine_suspended;
                    }
                    CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics2 = new CyclingPowerMeasurementCharacteristics(cyclingPowerService);
                    cyclingPowerMeasurementCharacteristics2.enableNotify();
                    cyclingPowerService.cyclingPowerMeasurementCharacteristics = cyclingPowerMeasurementCharacteristics2;
                    cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                    cyclingPowerService$initialization$1.label = 4;
                    if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) != coroutine_suspended) {
                    }
                }
                CyclingPowerFeatureCharacteristics cyclingPowerFeatureCharacteristics = new CyclingPowerFeatureCharacteristics(cyclingPowerService);
                cyclingPowerFeatureCharacteristics.read();
                cyclingPowerService.cyclingPowerFeatureCharacteristics = cyclingPowerFeatureCharacteristics;
                cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                cyclingPowerService$initialization$1.label = 2;
                if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
                    return coroutine_suspended;
                }
                CyclingPowerVectorCharacteristics cyclingPowerVectorCharacteristics2 = new CyclingPowerVectorCharacteristics(cyclingPowerService);
                cyclingPowerVectorCharacteristics2.enableNotify();
                cyclingPowerService.cyclingPowerVectorCharacteristics = cyclingPowerVectorCharacteristics2;
                cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                cyclingPowerService$initialization$1.label = 3;
                if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
                }
                CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics22 = new CyclingPowerMeasurementCharacteristics(cyclingPowerService);
                cyclingPowerMeasurementCharacteristics22.enableNotify();
                cyclingPowerService.cyclingPowerMeasurementCharacteristics = cyclingPowerMeasurementCharacteristics22;
                cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
                cyclingPowerService$initialization$1.label = 4;
                if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) != coroutine_suspended) {
                }
            }
        }
        cyclingPowerService$initialization$1 = new CyclingPowerService$initialization$1(this, (Continuation<? super CyclingPowerService$initialization$1>) continuation);
        Object obj2 = cyclingPowerService$initialization$1.result;
        coroutine_suspended = IntrinsicsKt.getCOROUTINE_SUSPENDED();
        i = cyclingPowerService$initialization$1.label;
        if (i != 0) {
        }
        CyclingPowerFeatureCharacteristics cyclingPowerFeatureCharacteristics2 = new CyclingPowerFeatureCharacteristics(cyclingPowerService);
        cyclingPowerFeatureCharacteristics2.read();
        cyclingPowerService.cyclingPowerFeatureCharacteristics = cyclingPowerFeatureCharacteristics2;
        cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
        cyclingPowerService$initialization$1.label = 2;
        if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
        }
        CyclingPowerVectorCharacteristics cyclingPowerVectorCharacteristics22 = new CyclingPowerVectorCharacteristics(cyclingPowerService);
        cyclingPowerVectorCharacteristics22.enableNotify();
        cyclingPowerService.cyclingPowerVectorCharacteristics = cyclingPowerVectorCharacteristics22;
        cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
        cyclingPowerService$initialization$1.label = 3;
        if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) == coroutine_suspended) {
        }
        CyclingPowerMeasurementCharacteristics cyclingPowerMeasurementCharacteristics222 = new CyclingPowerMeasurementCharacteristics(cyclingPowerService);
        cyclingPowerMeasurementCharacteristics222.enableNotify();
        cyclingPowerService.cyclingPowerMeasurementCharacteristics = cyclingPowerMeasurementCharacteristics222;
        cyclingPowerService$initialization$1.L$0 = cyclingPowerService;
        cyclingPowerService$initialization$1.label = 4;
        if (cyclingPowerService.delayInPeer(cyclingPowerService$initialization$1) != coroutine_suspended) {
        }
        return coroutine_suspended;
    }
}
